#include "qcapacitoritem.h"

QCapacitorItem::QCapacitorItem(QStringList header,QStringList values)
	: QBDDItem(header,values)
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	m_type =PART_CAPACITOR;
	m_bddFile = DB_CAPACITOR_FILE;

	if(header.contains(LA_DESC))
	{
		QString desc = values[header.indexOf(LA_DESC)];
		m_properties[PART_PACKAGE]				= extractFrom(desc,RE_PACKAGE);
		m_properties[PART_VOLTAGE]				= extractFrom(desc,RE_VOLTAGE);
		m_properties[PART_TOLERANCE]			= extractFrom(desc,RE_TOLERANCE);
		m_properties[PART_CAPACITOR_VALUE]		= QNormalize::units(RE_GENERAL_LOW_VALUE,extractFrom(desc,RE_CAPACITOR_VALUE),PART_CAPACITOR_UNIT);
	}
	else
		m_properties[PART_PACKAGE] = m_properties[PART_VOLTAGE] = m_properties[PART_TOLERANCE] = m_properties[PART_CAPACITOR_VALUE] =PART_UNKNOWN;
}


QCapacitorItem::QCapacitorItem(QByteArray in)
	: QBDDItem(in)
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	m_type =PART_CAPACITOR;
   m_bddFile = DB_CAPACITOR_FILE;
}

QCapacitorItem::~QCapacitorItem()
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
}

QStringList QCapacitorItem::cat_1() 
{ 
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	QStringList list;
	list << LA_CAPACITOR_TYPE_1; 
	return list; 
}

QStringList QCapacitorItem::cat_2()
{ 
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	QStringList list;
	list << LA_CAPACITOR_TYPE_2; 
	return list; 
}